<template>
  <div class="enterprise-list">
    <Divider />
    <h3 class="title">接收{{showFeedback ?'及反馈':''}}情况</h3>

    <div class="mb-20" v-for="(item, index) in busiIndustryAssignList" :key="index">
      <Row justify="space-between" align="middle" class="mb-10">
        <h4>{{ item.industryName }}</h4>
        <div v-if="item.receiveStatus === 'UnReceive' && item.forewarningEndDate">
          <span>接收倒计时</span>
          <Countdown :time="item.forewarningEndDate" />
        </div>
      </Row>
      <Table :columns="columns" :data="item.busiIndustryCompanyList" :row-class-name="rowClassName"></Table>
      <Feedback
        v-if="showFeedback"
        :feedbackEndDate="item.feedbackEndDate"
        :receiveStatus="item.receiveStatus"
        :feedbackDetailVoList="item.feedbackVoList"
      />
    </div>
  </div>
</template>

<script>
import Feedback from './feedback.vue'
import Countdown from './countdown.vue'

export default {
  name: 'receiveList',
  components: { Feedback, Countdown },
  props: {
    busiIndustryAssignList: {
      type: Array,
      default: () => []
    },
    // 是否显示反馈详情
    showFeedback: {
      type: Boolean,
      default: true
    }
  },
  data () {
    return {
      columns: [
        {
          title: '公司名称',
          key: 'companyName',
          minWidth: 240,
          tooltip: true
        },
        {
          title: '推送方式',
          key: 'notificationWayName',
          minWidth: 120,
        },
        {
          title: '接收状态',
          key: 'receiveStatusName',
          minWidth: 120,
          pageType: 'view'
        },
        {
          title: '拒绝理由',
          key: 'reasonForRejection',
          pageType: 'view',
          minWidth: 240,
          tooltip: true
        },
        {
          title: '操作时间',
          key: 'handleDate',
          pageType: 'view',
          minWidth: 170,
        }
      ],
    }
  },
  methods: {
    rowClassName (row, index) {
      return row.receiveStatus === 'Receive' ? 'table-info-row-green' : ''
    }
  }
}
</script>

<style lang='less' scoped>
.enterprise-list {
  .title {
    margin: 20px 0;
  }
}
.mb-20 {
  margin-bottom: 20px;
}
.mb-10 {
  margin-bottom: 10px;
}
</style>
<style lang="less">
.ivu-table .table-info-row-green {
  color: #19be6b;
  font-weight: 700;
}
</style>